<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
The Multi-Directional Arithmetic Predicates
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot046.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot042.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot048.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc124">8.5</A>&nbsp;&nbsp;The Multi-Directional Arithmetic Predicates</H2>
<A NAME="@default432"></A>
<A NAME="@default433"></A>
<A NAME="@default434"></A>
A drawback of arithmetic using <A HREF="../bips/kernel/arithmetic/is-2.html"><B>is/2</B></A><A NAME="@default435"></A> is that the right hand side must
be fully instantiated at evaluation time.
Often it is desirable to have predicates that define true logic
relationships between their arguments like &#8220;Z is the sum of X and Y&#8221;.
For integer addition and multiplication this is provided as:
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>succ(X, Y)</B><DD CLASS="dd-description">
True if X and Y are natural numbers, and Y is one greater than X.
At most one of X, Y can be a variable.<BR>
<BR>
<DT CLASS="dt-description"><B>plus(X, Y, Z)</B><DD CLASS="dd-description">
True if the sum of X and Y is Z. At most one of X, Y, Z can be a variable.<BR>
<BR>
<DT CLASS="dt-description"><B>times(X, Y, Z)</B><DD CLASS="dd-description">
True if the product of X and Y is Z. At most one of X, Y, Z can be a variable.</DL>
They work only with integer arguments but any single argument
can be a variable which is then instantiated so that the relation holds.
If more than one argument is uninstantiated, an instantiation fault is produced.<BR>
<BR>
Note that if one of the first two arguments is a variable,
a solution doesn't necessarily exist. For example, the following goal has
no integer solution :
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
[eclipse 1]: times(2, X, 3).

no (more) solution.
</PRE></BLOCKQUOTE>
Since any one of the arguments of these two predicates can be a variable,
it does not make much sense to use them in arithmetic expressions
where always the first arguments are taken as input and the last
one as output. <BR>
<BR>
<HR>
<A HREF="umsroot046.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot042.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot048.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
